package com.minhua.jijiehao2.mainframe.mine.mineFragment.impl

import com.minhua.jijiehao2.base.BaseMvpPresenter
import com.minhua.jijiehao2.bean.BaseBean
import com.minhua.jijiehao2.bean.LoginBean
import com.minhua.jijiehao2.http.CallBack
import com.minhua.jijiehao2.http.ParamsMap
import com.minhua.jijiehao2.mainframe.mine.mineFragment.imp.IMinePresenter
import com.minhua.jijiehao2.mainframe.mine.mineFragment.imp.IMineView

class MinePresenter : BaseMvpPresenter<IMineView>(), IMinePresenter {

    private var mMineModel = MineModel()

    override fun getUserInfo() {
        val map = ParamsMap()
        mMineModel.getUserInfo(map, object : CallBack<LoginBean>() {
            override fun onSuccess(t: BaseBean<LoginBean>) {
                mMineModel.saveLoginInfo(t.data!!)
                v?.onUserInfoSuccess()
            }
        })
    }

    override fun getPhone() {
        val map = ParamsMap()
        mMineModel.getPhone(map, object : CallBack<String>() {
            override fun onSuccess(t: BaseBean<String>) {
                v?.onPhoneSuccess(t.data!!)
            }
        })
    }
}